home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / dejagnu.lha / dejagnu-1.0.1 / expect / expect.h < prev    next >
C/C++ Source or Header  |  1993-03-02  |  2KB  |  89 lines

  1. /* expect.h - include file for using the expect library, libexpect.a
  2.  
  3. Written by: Don Libes, libes@cme.nist.gov, NIST, 12/3/90
  4.  
  5. Design and implementation of this program was paid for by U.S. tax
  6. dollars.  Therefore it is public domain.  However, the author and NIST
  7. would appreciate credit if this program or parts of it are used.
  8. */
  9.  
  10. #include <stdio.h>
  11. #include <setjmp.h>
  12.  
  13. /* return values */
  14. /* -1 is reserved for system errors */
  15. #define EXP_TIMEOUT            -2
  16. #define EXP_EOF                -3
  17.  
  18. struct exp_case {        /* case for expect command */
  19.     char *pattern;        /* if pattern not in list */
  20.     int value;        /* value to be returned upon match */
  21. };
  22.  
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26.  
  27. extern char *exp_match;
  28. extern int exp_match_max;        /* bytes */
  29. extern int exp_timeout;    /* seconds */
  30. extern int exp_pid;            /* process-id of spawned process */
  31. extern int exp_autoallocpty;        /* if TRUE, we do allocation */
  32. extern int exp_pty[2];            /* master is [0], slave is [1] */
  33. extern int exp_disconnected;        /* proc. disc'd from controlling tty */
  34.  
  35. extern jmp_buf exp_readenv;        /* for interruptable read() */
  36. extern int exp_reading;            /* whether we can longjmp or not */
  37.  
  38. extern int exp_logfile_all;
  39. extern int exp_loguser;
  40. extern int exp_is_debugging;
  41. extern FILE *exp_debugfile;
  42. extern FILE *exp_logfile;
  43.  
  44. /* support for Standard C and C++ prototypes */
  45. #ifdef __cplusplus
  46. #define EXP_PROTOTYPES
  47. #define EXP_VARARGS    ...
  48. #else
  49. #define EXP_VARARGS    , ...
  50. #ifdef __STDC__
  51. #define EXP_PROTOTYPES
  52. #endif
  53. #endif
  54.  
  55. #ifdef EXP_PROTOTYPES
  56. #define EXP_PROTO(x)    x
  57. #ifdef EXP_DEFINE_FNS
  58. /* when functions are really being defined, we have to use va_alist as arg */
  59. #define EXP_PROTOV(x)    va_alist
  60. #else
  61. #define EXP_PROTOV(x)    x
  62. #endif
  63. #else
  64. #define EXP_PROTO(x)    ()
  65. #define EXP_PROTOV(x)    ()
  66. #endif
  67.  
  68. /* Put double parens around macro args so they all look like a single arg */
  69. /* to preprocessor.  That way, don't need a different macro for functions */
  70. /* with a different number of arguments. */
  71.  
  72. extern int exp_disconnect EXP_PROTO(());
  73. extern FILE *exp_popen    EXP_PROTO((char *command));
  74.  
  75. #ifndef EXP_DEFINE_FNS
  76. extern int exp_spawnl    EXP_PROTOV((char *file EXP_VARARGS));
  77. extern int exp_expectl    EXP_PROTOV((int fd EXP_VARARGS));
  78. extern int exp_fexpectl    EXP_PROTOV((FILE *fp EXP_VARARGS));
  79. #endif
  80.  
  81. extern int exp_spawnv    EXP_PROTO((char *file, char *argv[]));
  82. extern int exp_expectv    EXP_PROTO((int fd, struct exp_case *cases));
  83. extern int exp_fexpectv    EXP_PROTO((FILE *fp, struct exp_case *cases));
  84.  
  85. #ifdef __cplusplus
  86. }
  87. #endif
  88.  
  89.